<template>
<div>
  <div class="header">
    <div class="header-left">
      <div class="iconfont back-icon">&#xe624;</div>
    </div>
    <div class="header-input">
      <span class="iconfont">&#xe632;</span>
      输入城市/景点
    </div>
    <router-link to = '/city'>
    <!--  to = '/city' 跳转到city目录下 -->
      <div class="header-right">
        {{this.city}}
        <span class="iconfont arrow-icon">&#xe6aa;</span>
      </div>
    </router-link>
  </div>
</div>
</template>

<script>
// mapState作用：可以辅助获取到多个state的值
import { mapState } from 'vuex'
export default {
  name: 'HomeHeader',
  computed: {
    ...mapState(['city'])
  }
}
</script>

<style lang="stylus" scoped>
   @import '~@/assets/styles/varibles.styl'
// eslint-disable-next-line
// scoped 限制下面的header只对当前的组件有效，不会对其他组件产生任何影响
   .header
      display: flex
      line-height: $headerHeight
      height: $headerHeight
      background: $bgColor
      color: #ffffff
      .header-left
        width: 32px
        float: left
        .back-icon
          text-align: center
          font-size: 20px
      .header-input
        flex: 1
        height: 32px
        line-height: 32px
        margin-top: 6px
        margin-left: 1px
        padding-left: 5px
        background: #fff
        border-radius: 1px
        color: #ccc
      .header-right
        min-width: 52px
        padding: 5px
        float: right
        text-align: center
        color #fff
        .arrow-icon
          margin-left: -2px
          font-size: 12px
</style>
